<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
    function getAge() {
        // 今年-出生年
        var now = new Date().getFullYear();
        return now -this.birth;
    }
    var zdw = {
        name:'可乐',
        birth: 2002,
        age:getAge
    }

    // zdw.age();

    var xiaosan = {
        name:'xiaosan',
        birth:2001,
        age:getAge
    }

    getAge.apply(xiaosan,[]);  // this，指向了xiaosan，参数为空
</script>

</body>
</html>